#ifndef PURE_REQUEST_H_
#define PURE_REQUEST_H_

#include "PureObject.h"
#include "PureURI.h"

namespace Pure
{
    /** Forward declarations. **/
    class IResponseHandler;
    
    class Request : public Object
    {
    public:        
        Request(const URI &uri);
        ~Request();

        /**
         * Enum representing all supported http methods.
         */
        enum Method
        {
            GET = 0,
            POST = 1,
            HEAD = 2,
            PUT = 3
        };
        
        /**
         * Return the method of this request.
         * @return A Method enum value.
         */
        Method getMethod();
        
        /**
         * Return the value of the header with the given key.
         * @param key A null-terminated header key.
         * @return A null-terminated value or NULL.
         */
        const char* getHeaderValue(const char* key);
        
        /**
         * Return the body of the request.
         * @return A null-terminated string or NULL.
         */
        const char* getBody();
                
        /**
         * Add a http request header.
         * @param key A null-terminated string containing a header key.
         * @param value A null-terminate string containing the key's value.
         */
        void addHeader(const char* key, const char* value);
        
        /**
         * Append the buffer to the end of the accumulated body buffer.
         * @param body A null-terminated string.
         */
        void appendBody(const char* body);
        
        /**
         * Set the http method enum value.
         * @param method An enum value representing a http method.
         */
        void setMethod(Method method);
        
        /**
         * Set the handler for a response.
         * @param handler An implementation of IResourceHandler to receive status, headers,
         *                and the response body.
         */
        void setResponseHandler(const IResponseHandler* handler);
    
    private:
        /** Private data struct. **/
        struct Private;
        RequestPrivate* mPrivateData;
    };
    
} // end namespace Pure

#endif /*PURE_REQUEST_H_*/
